import os
def filesize(dir1):
    sum=0
    dlist = os.listdir(dir1)
    for f in dlist:
        file= os.path.join(dir1,f)
        if os.path.isfile(file):
            sum +=os.path.getsize(file)
        if os.path.isdir(file):
            sum+=filesize(file)
    return sum

path=input("请输入需要统计的目录的完整路径:")
number=filesize(path)
print(number)
